use std::collections::{btree_map::Entry, HashMap};

fn main() {
    let a = [1, 2, 3];
    let b = [4, 5, 6];

    let zipped: Vec<(&i32, &i32)> = a.iter().zip(b.iter()).collect();
    println!("{:?}", zipped);
    for (x, y) in zipped {
        println!("({}, {})", x, y);
    }

    // for (x, y) in zipped {
    //     println!("({}, {})", x, y);
    // }
    let mut map: HashMap<String, i32> = HashMap::new();
    map.insert(String::from("blue"), 10);
    map.insert(String::from("Yellow"), 50);
    // println!("{:?}", map);
    let teams = vec![String::from("Blue"), String::from("Yellow")];
    let initial_scores = vec![10, 50];
    let score: HashMap<_, _> = teams.iter().zip(initial_scores).collect();
    println!("{:?}", score);
    let field_name = String::from("Favorite color");
    let field_value = String::from("Blue");

    let mut map: HashMap<&String, &String> = HashMap::new();
    map.insert(&field_name, &field_value);

    let val = map.get(&field_name);
    println!("{:?}", val);
    let str: String = String::from("haha");
    let name: String = String::from("haha");
    map.entry(&field_name).or_insert(&str);
    let enter_v = map.entry(&name).or_insert(&str);
    println!("{:?}", enter_v);
    println!("{:?}", map);
    let text = "hello world wonderful world";
    let mut map = HashMap::new();
    for word in text.split_whitespace() {
        let count = map.entry(word).or_insert(0);
        *count += 1;
    }
    println!("{:?}", map)
}
